package cn.ad.server.web.spring.model.adview;

import cn.ad.server.domain.enumration.Operator;

import java.util.HashMap;
import java.util.Map;

/**
 * @author dongbin.yu
 * @from 2016-08-12
 * @since V1.0
 */
public enum AdViewOperator {

    UNKNOWN("0", Operator.UNKNOWN),
    CHINA_MOBILE("46000,46002,46007",Operator.CHINA_MOBILE),
    CHINA_UNICOM("46001,46006",Operator.CHINA_UNICOM),
    CHINA_TELECOM("46003,46005",Operator.CHINA_TELECOM);

    private String value;
    private Operator operator;

    public final static Map<String, Operator> adViewOperatorMap = new HashMap<>();

    static {
        for (AdViewOperator adViewOperator : AdViewOperator.values()) {
            for (String operatorCode : adViewOperator.value.split(",")) {
                adViewOperatorMap.put(operatorCode, adViewOperator.operator);
            }
        }
    }

    AdViewOperator(String value, Operator operator) {
        this.value = value;
        this.operator = operator;
    }
}
